Optimize UI5BindingPath.getNode() and constructPathStringInner evaluation performance#350
Closed
Optimize UI5BindingPath.getNode() and constructPathStringInner evaluation performance#350
Conversation
5 tasks
Agent-Logs-Url: https://github.com/advanced-security/codeql-sap-js/sessions/b8d4d32d-c84b-4174-bc1e-f00aa8b7ede4 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
…mance - Extract getNode() disjuncts 1-1 and 1-2 into pragma[nomagic] helper predicates (getHardcodedJsonModelNode, getJsonFileModelNode) to prevent cross-product explosion on large codebases. This matches the existing pattern used for disjuncts 1-3 and 2. - Add pragma[nomagic] to both constructPathStringInner recursive predicates to prevent inlining into calling contexts. Addresses the critical UI5Xss.ql ~240x performance regression on large databases where getNode() accounted for 98.4% of evaluation time. Agent-Logs-Url: https://github.com/advanced-security/codeql-sap-js/sessions/b8d4d32d-c84b-4174-bc1e-f00aa8b7ede4 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Agent-Logs-Url: https://github.com/advanced-security/codeql-sap-js/sessions/b8d4d32d-c84b-4174-bc1e-f00aa8b7ede4 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Agent-Logs-Url: https://github.com/advanced-security/codeql-sap-js/sessions/b8d4d32d-c84b-4174-bc1e-f00aa8b7ede4 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize query evaluation performance for UI5BindingPath.getNode()
Optimize UI5BindingPath.getNode() and constructPathStringInner evaluation performance
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This PR Contributes
Profiling revealed
UI5BindingPath.getNode()accounts for 98.4% of evaluation time (~33 minutes) whenUI5Xss.qlruns standalone on large UI5 monorepo databases — a ~240x slowdown for ~2x data size. Root cause: disjuncts 1-1 and 1-2 lackedpragma[nomagic], causing the evaluator to inline their joins into a single relation and producing a cross-product explosion.getNode()inUI5View.qll: Extract disjuncts 1-1 and 1-2 into dedicatedpragma[nomagic]helper predicates (getHardcodedJsonModelNode,getJsonFileModelNode), matching the pattern already used for disjuncts 1-3 and 2constructPathStringInnerinUI5.qll: Addpragma[nomagic]to both recursive overloads to prevent inlining into callersAll 74 existing UI5 tests pass unchanged.
Future Works
CdsTransaction.getContextObject(): Investigated restrictinggetAPredecessor+()to same container, butcds.contextassignments can legitimately be in outer scopes. Needs a more nuanced scoping strategy.TVarRefinementContextbaseline cost: This is acodeql/javascript-allpredicate — not addressable here. Custom queries could potentially be restructured to reduce dependence on full type inference.UI5Xss.qleval-time gate on a large UI5 monorepo database.